﻿//844.比较含退格的字符串
bool backspaceCompare(char* s, char* t) {
    char sc[200];
    int j = 0;
    for (int i = 0; i < strlen(s); i++)
    {
        if (s[i] == '#')
        {
            if (j > 0)
            {
                j--;
            }
        }
        else
        {
            sc[j++] = s[i];
        }
    }
    sc[j] = '\0';

    char tc[200];
    j = 0;
    for (int i = 0; i < strlen(t); i++)
    {
        if (t[i] == '#')
        {
            if (j > 0)
            {
                j--;
            }
        }
        else
        {
            tc[j++] = t[i];
        }
    }
    tc[j] = '\0';

    return !strcmp(sc, tc);
}